package JavaSE.Class12.Demo2;

public class Demo_2 {
    public static void swap2(MyValue v1, MyValue v2){
        int temp = v1.value;
        v1.value = v2.value;
        v2.value = temp;
    }

    public static void swap1(int a,int b){
        int temp = a;
        a = b;
        b = temp;
    }

    public static void main(String[] args) {
        MyValue MyV1=new MyValue();
        MyValue MyV2=new MyValue();
        MyV1.value=10;
        MyV2.value=20;

        System.out.println("before "+MyV1.value+" "+MyV2.value);
        swap1(MyV1.value,MyV2.value);
        System.out.println("last   "+MyV1.value+" "+MyV2.value);

        System.out.println("=============");

        System.out.println("before "+MyV1.value+" "+MyV2.value);
        swap2(MyV1, MyV2);
        System.out.println("last   "+MyV1.value+" "+MyV2.value);
    }
}
